package com.example.smartmedicalsystem.repository;

import com.example.smartmedicalsystem.entity.Schedule;
import com.example.smartmedicalsystem.entity.Doctor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.DayOfWeek;
import java.util.List;

@Repository
public interface ScheduleRepository extends JpaRepository<Schedule, Long> {
    List<Schedule> findByDoctor(Doctor doctor);
    // 根据医生和星期及时间段查询（用于搜索预约时判断医生是否有班次）
    List<Schedule> findByDoctorAndDayOfWeek(Doctor doctor, DayOfWeek dayOfWeek);
    List<Schedule> findByDoctorOrderByDateDesc(Doctor doctor);
}
